package com.wy.w_ui.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;

public class CViewPager extends LinearLayout {

    private ViewPager viewPager;

    public CViewPager(Context context) {
        super(context);
        viewPager = new ViewPager(context);
        init();
    }

    public CViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
        viewPager = new ViewPager(context,attrs);
        init();
    }

    public CViewPager(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        viewPager = new ViewPager(context,attrs);
        init();
    }

    public CViewPager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        viewPager = new ViewPager(context,attrs);
    }

    public void init(){

        addView(viewPager);
        setOrientation(LinearLayout.VERTICAL);
    }

    public void setAdapter(PagerAdapter adapter){
        viewPager.setAdapter(adapter);
    }
}
